<template>
	<view>
		<u-navbar :title="title" fixed placeholder autoBack border></u-navbar>
		<view class="content">
			<u-gap height="10" bgColor="#f5f5f5"></u-gap>
			<view class="article">
				<view class="time">
					<text>{{subName}}</text>
					<text>发布于：{{dateFormat(createTime)}}</text>
					<u-gap height="1" bgColor="#f5f5f5"></u-gap>
				</view>
				<u-parse :content="content"></u-parse>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getDetail,
	} from '@/api/notice.js'
	import {
		dateFormat
	} from '@/utils/date.js'
	export default {
		data() {
			return {
				title: '',
				content: '',
				subName: '',
				createTime: '',
				dateFormat: dateFormat,
			}
		},
		onLoad(e) {
			const id = e.id
			getDetail(e.id).then(res => {
				const {
					title,
					content,
					subName,
					createTime,
					updateTime
				} = res.data
				this.title = title
				this.content = content
				this.subName = subName
				this.createTime = createTime
			})
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		background-color: #fff;

		.article {
			width: 96%;
			margin: auto;
		}

		.time {
			display: flex;
			margin: 10px 0;
			padding-bottom: 10px;
			border-bottom: 1px solid #eeeeee;

			&>text {
				display: block;
				color: #ccc;
				font-size: 10px;
			}
			
			text:first-child {
				padding-right: 20px;
			}
		}
	}
</style>
